package com.icode.core.model.house;

import com.icode.core.model.AbstractEntity;

import javax.persistence.*;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: lb
 * Date: 15-11-13
 * Time: 下午5:25
 * To change this template use File | Settings | File Templates.
 */

@Entity
@Table(name = "banner_for_app")
public class BannerForApp extends AbstractEntity {


    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
    @JoinColumn(name = "banner_for_app_id")
    private List<FirstBanners> firstBanners;


    @OneToOne(cascade = CascadeType.ALL)
    @JoinColumn(name = "second_banner_id")
    private UploadImage secondBanner;


    public BannerForApp() {
    }

    public BannerForApp(List<FirstBanners> firstBanners, UploadImage secondBanner) {
        this.firstBanners = firstBanners;
        this.secondBanner = secondBanner;
    }

    public List<FirstBanners> firstBanners() {
        return firstBanners;
    }

    public UploadImage secondBanner() {
        return secondBanner;
    }

    public void update(List<FirstBanners> firstImages, UploadImage secondImage) {
        this.firstBanners = firstImages;
        this.secondBanner = secondImage;
    }

    public void updateImage(UploadImage secondImg) {
        this.secondBanner = secondImg;
    }

    public void updateImages(List<FirstBanners> firstBannerses) {
        this.firstBanners = firstBannerses;
    }

    public void updateSecondBanner(UploadImage uploadImage) {
        this.secondBanner = uploadImage;
    }
}
